package com.prs.crm.dao.official.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.official.PersonalMailAutographDao;
import com.prs.crm.domain.official.PersonalMailAutograph;

public class PersonalMailAutographDaoImpl extends BaseDaoImpl<PersonalMailAutograph> implements PersonalMailAutographDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<PersonalMailAutograph> getAllPersonalMailAutograph() {
		Criteria criteria=this.getSession().createCriteria(PersonalMailAutograph.class);
		return criteria.list();
	}

	@Override
	public PersonalMailAutograph getPersonalMailAutographById(Integer id) {
		Criteria criteria=this.getSession().createCriteria(PersonalMailAutograph.class)
		.add(Restrictions.eq("id", id));
		return (PersonalMailAutograph) criteria.list().get(0);
	}

}
